home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / cross / devpic.lha / picasm-src / picasm.doc < prev    next >
Text File  |  1999-12-02  |  8KB  |  216 lines

  1.  
  2.   Assembler for Microchip PIC16Cxx microcontrollers
  3.   -------------------------------------------------
  4.  
  5.                   version 1.06
  6.  
  7.  
  8.   Copyright 1995-1998 by Timo Rossi.  All rights reserved.
  9.   See the file "LICENSE" for more information about redistribution
  10.   conditions.
  11.  
  12.   Suggestions and bug reports are welcome.
  13.  
  14.     Timo Rossi
  15.     email: trossi@iki.fi
  16.     www: http://www.iki.fi/trossi/pic/
  17.  
  18.   AmigaOS port by RDC <rdc@cyberstorm.mtu-net.ru>
  19.  
  20.   The code is (mostly) ANSI-C, and should compile with most
  21.   platforms (It does assume that negative integers are
  22.   stored in two's complement representation) And it
  23.   uses the strcasecmp() or stricmp() function)
  24.  
  25.  
  26.  Command line usage:
  27.     picasm [-o<objname>] [-l<listfile>] [-ihx8m] [-ihx16]
  28.            [-pic<device>] <filename>
  29.  
  30.  Options:
  31.     -o<filename>  Define output file name.
  32.                   Default is <source_without_ext>.hex
  33.  
  34.     -l<listfile>  Enable listing. Default listing
  35.                   file name is <source_without_ext>.lst
  36.  
  37.     -s            Includes symbol table in listing.
  38.                   Does nothing if listing is not enabled.
  39.  
  40.     -w<warnlevel> Give more warnings. If <warnlevel> is omitted,
  41.                   one is assumed. Level two warns also
  42.           about tris/option instructions on 14-bit PICs.
  43.           
  44.  
  45.     -ihx8m        IHX8M output format (default).
  46.     -ihx16        IHX16 output format.
  47.  
  48.     -pic<device>  select PIC device
  49.      Supported all PIC12/14/16 devices from 3Q 1999 Product Line Card
  50.  
  51.   This is a single-pass assembler, forward gotos/calls are patched
  52.   at the end of the assembly (only single labels are accepted in
  53.   that case, otherwise expressions can be used too)
  54.  
  55.   In current versions forward references can also be used
  56.   with movlw, addlw and retlw (only the low 8 bits of an address are used)
  57.  
  58.   Expressions can have the following elements:
  59.   (from highest precedence to the lowest)
  60.  
  61.    integer constants
  62.    symbols
  63.    (<expression>)
  64.    . (or $)   current location
  65.  
  66.    defined(symbol)      -- TRUE (-1) if symbol is defined else FALSE (0)
  67.  
  68.    streq("str1","str2") -- TRUE if strings are identical.
  69.  
  70.    isstr(arg)           -- TRUE is argument is a quoted string
  71.  
  72.    chrval("str", pos)   -- Returns ASCII character code from the string.
  73.                            position range is from 0 to string length-1.
  74.                            If position is out of range, returns -1.
  75.  
  76.    [expr1 expr2 ... exprn] -- the same as (1<<expr1) | (1<<expr2) ...
  77.             (builds a number by setting individual bits)
  78.  
  79.    -   unary minus
  80.    ~   bitwise not
  81.  
  82.    *   multiply
  83.    /   divide
  84.    %   modulo/remainder
  85.    &   bitwise and
  86.  
  87.    +   add
  88.    -   subtract
  89.    |   bitwise or
  90.    ^   bitwise exclusive or
  91.    <<  shift left
  92.    >>  shift right
  93.  
  94.    ==     equal
  95.    != <>  not equal
  96.    <      less than
  97.    <= =<  less or equal than
  98.    >      greater than
  99.    >= =>  greater or equal than
  100.  
  101.   The compare operators return TRUE (-1) or FALSE (0)
  102.   (they are useful with conditional assembly)
  103.  
  104.   Expressions are evaluated as 32-bit integers (or whatever size 'long' is).
  105.  
  106.   hex numbers: 0x<digits>, h'<digits>', $<digits>
  107.                or <digits>h (must begin with 0..9)
  108.   octal numbers:  <digits>o, o'<digits>'
  109.   binary numbers: 0b<digits>, b'<digits>' or <digits>b
  110.   decimal numbers without prefix or d'<digits>'
  111.  
  112.   Directives:
  113.   (square brackets denote optional parameters)
  114.  
  115. <label>   equ   <expr>   - Define a constant
  116. <label>   set   <expr>   - Define a variable (similar to equ but
  117.                            can be redefined with another set-directive)
  118.  
  119.   org <address>
  120.   org <address>,<mode>
  121.   org <mode>
  122.     - Specify origin for program code, register file or data EEPROM.
  123.  
  124.     <mode> is 'code' for program code, 'reg' for register file
  125.     and 'edata' for data EEPROM. If mode is not given, it is
  126.     determined automatically from first instruction that generates
  127.     output to the hex file. After that the mode cannot be changed
  128.     without another ORG statement. When ORG is used with only
  129.     the mode parameter, the address continues from the last value
  130.     for that mode.
  131.  
  132.  
  133.   include <filename>   - Include another source file. includes can be nested.
  134.  
  135.   end                  - End assembly. anything after this is ignored.
  136.  
  137. <label>  ds     <expr>   - Reserve <expr> number of file register (RAM)
  138.                            locations. ORG must be set for this to work.
  139.  
  140. <label>  edata  <expr>[, <expr>...]
  141.                          - Define data EEPROM contents (only with PIC16C84 / 16C83 / 16F84)
  142.  
  143.          if     <expr>   - Conditional assembly. If <expr> is non-zero,
  144.         <code1>            <code1> after the if-directive is assembled,
  145.         [else              and the optional <code2> is skipped. If <expr>
  146.         <code2>]           is zero, <code1> is skipped and optional
  147.          endif             <code2> is assembled.
  148.  
  149. <macroname> macro        - Define a macro.
  150.             <macro definition>
  151.             endm
  152.  
  153.    Macro parameters are \1...\9, \# is the number of parameters.
  154.    \@ (or \0) is an number that is different  for each macro
  155.    expansion (it can be used to generate unique labels inside macros).
  156.    Macros can be recursive.
  157.  
  158.          exitm          - Exit macro (can only be used inside a macro
  159.                           definition. Useful with conditional assembly)
  160.  
  161.      local        - Begin and end a local label/symbol block.
  162.      endlocal         Local symbols must be prefixed with '='
  163.                           and their name scope is only
  164.                           the current local symbol block.
  165.                           Local symbol blocks can be nested
  166.                           but only the symbols in the currently
  167.                           active block can be used (the symbols
  168.                           in the inner and outer blocks are not visible)
  169.  
  170.          config <config_param>[, <config_param>...]
  171.                         - Define PIC configuration fuse data.
  172.                           <config_param> can be:
  173.  
  174.                           CP=<on_off>      - code protection (default off,
  175.                                              partial protection not supported)
  176.  
  177.                           PWRT=<on_off>    - powerup timer (default varies
  178.                                              with PIC models, not valid
  179.                                              with 12-bit PICs)
  180.  
  181.                           WDT=<on_off>     - watchdog (default on)
  182.  
  183.                           BOD=<on_off>     - brown-out detect. only valid
  184.                                              with some PIC models.
  185.  
  186.                           OSC=<osctype>    - oscillator type (typically HS,XT,LP,RC,
  187.                          some PIC models have different options)
  188.  
  189.                           The <on_off> parameter can be:
  190.                             on, yes, enabled  - on
  191.                             off, no, disabled - off
  192.  
  193.                           The fuses are located in address 0xfff with
  194.                           12-bit PICs and 0x2007 with 14-bit PICs.
  195.  
  196.  
  197.          picid <id1>,<id2>,<id3>,<id4>
  198.                          - Define PIC ID values.
  199.                The ID is located in the hex file at the address
  200.                            following program memory end with 12-bit PICs,
  201.                            and at 0x2000 with 14-bit PICs.
  202.  
  203.  
  204.          device <device> - select PIC device type
  205.                          Valid values are listed in the command line
  206.                          option section (the -pic<type> option).
  207.  
  208.  
  209.          opt    <option> - set assembly options
  210.                          Currently only implemented:
  211.                            list or l     - turn listing on
  212.                            nolist or nol - turn listing off
  213.  
  214.          error           - causes an assembly error
  215.  
  216.